package com.ruoyi.factorydata.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.factorydata.mapper.ProcessStationRelationMapper;
import com.ruoyi.factorydata.domain.ProcessStationRelation;
import com.ruoyi.factorydata.service.IProcessStationRelationService;

/**
 * 工序工位关联Service业务层处理
 *
 * @author ruoyi
 * @date 2025-07-12
 */
@Service
public class ProcessStationRelationServiceImpl extends ServiceImpl<ProcessStationRelationMapper, ProcessStationRelation> implements IProcessStationRelationService {
    @Autowired
    private ProcessStationRelationMapper processStationRelationMapper;

    /**
     * 查询工序工位关联
     *
     * @param id 工序工位关联主键
     * @return 工序工位关联
     */
    @Override
    public ProcessStationRelation selectProcessStationRelationById(Long id) {
        return processStationRelationMapper.selectProcessStationRelationById(id);
    }

    /**
     * 查询工序工位关联列表
     *
     * @param processStationRelation 工序工位关联
     * @return 工序工位关联
     */
    @Override
    public List<ProcessStationRelation> selectProcessStationRelationList(ProcessStationRelation processStationRelation) {
        return processStationRelationMapper.selectProcessStationRelationList(processStationRelation);
    }

    /**
     * 新增工序工位关联
     *
     * @param processStationRelation 工序工位关联
     * @return 结果
     */
    @Override
    public int insertProcessStationRelation(ProcessStationRelation processStationRelation) {
                processStationRelation.setCreateTime(DateUtils.getNowDate());
            return processStationRelationMapper.insertProcessStationRelation(processStationRelation);
    }

    /**
     * 修改工序工位关联
     *
     * @param processStationRelation 工序工位关联
     * @return 结果
     */
    @Override
    public int updateProcessStationRelation(ProcessStationRelation processStationRelation) {
                processStationRelation.setUpdateTime(DateUtils.getNowDate());
        return processStationRelationMapper.updateProcessStationRelation(processStationRelation);
    }

    /**
     * 批量删除工序工位关联
     *
     * @param ids 需要删除的工序工位关联主键
     * @return 结果
     */
    @Override
    public int deleteProcessStationRelationByIds(Long[] ids) {
        return processStationRelationMapper.deleteProcessStationRelationByIds(ids);
    }

    /**
     * 删除工序工位关联信息
     *
     * @param id 工序工位关联主键
     * @return 结果
     */
    @Override
    public int deleteProcessStationRelationById(Long id) {
        return processStationRelationMapper.deleteProcessStationRelationById(id);
    }
}